package com.settlement.system.model.entity.common;

import java.math.BigDecimal;
import java.util.Date;

import java.io.Serializable;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.settlement.system.common.enums.WpTypeEnum;
import com.settlement.system.converter.DateFormatYearMonthConvert;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * AP_543-本月收发存数量汇总表
 * @author Ximi
 * @since 2020-10-28
 */
@Data
@ExcelIgnoreUnannotated
@HeadStyle(fillBackgroundColor = 9,fillForegroundColor = 9)
@HeadRowHeight(value = 20)
@HeadFontStyle(fontHeightInPoints = 14)
public class TblWpThisMonthIosSummary extends BaseModel implements Serializable {


    /**
     * 主体
     */
    @ExcelProperty(value = "主体")
    @ApiModelProperty(value = "主体")
    private String mainBody;

    /**
     * 期间
     */
    @ExcelProperty(value = "期间",converter = DateFormatYearMonthConvert.class)
    @ApiModelProperty(value = "期间")
    @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
    private Date period;

    /**
     * 供应商编号
     */
    @ExcelProperty(value = "供应商编号")
    @ApiModelProperty(value = "供应商编号")
    private String vendorCode;

    /**
     * 供应商名称
     */
    @ExcelProperty(value = "供应商名称")
    @ApiModelProperty(value = "供应商名称")
    private String vendorName;

    /**
     * po
     */
    @ExcelProperty(value = "po")
    @ApiModelProperty(value = "po")
    private String poNo;

    /**
     * 原采购单号
     */
    @ExcelProperty(value = "原采购单号")
    @ApiModelProperty(value = "原采购单号")
    private String origPoNo;

    /**
     * PO类型
     */
    @ExcelProperty(value = "PO类型")
    @ApiModelProperty(value = "PO类型")
    private String poType;

    /**
     * 品牌名称
     */
    @ExcelProperty(value = "品牌名称")
    @ApiModelProperty(value = "品牌名称")
    private String brandName;

    /**
     * 条码
     */
    @ExcelProperty(value = "条码")
    @ApiModelProperty(value = "条码")
    private String barcode;

    /**
     * 产品说明
     */
    @ExcelProperty(value = "产品说明")
    @ApiModelProperty(value = "产品说明")
    private String productDescription;

    /**
     * 本期期初
     */
    @ExcelProperty(value = "本期期初")
    @ApiModelProperty(value = "本期期初")
    private Integer thisPeriodStartQty;

    /**
     * 本期入库
     */
    @ExcelProperty(value = "本期入库")
    @ApiModelProperty(value = "本期入库")
    private Integer thisPeriodStockInQty;

    /**
     * 本期退供
     */
    @ExcelProperty(value = "本期退供")
    @ApiModelProperty(value = "本期退供")
    private Integer thisPeriodStockReturnQty;

    /**
     * 本期销售
     */
    @ExcelProperty(value = "本期销售")
    @ApiModelProperty(value = "本期销售")
    private Integer thisPeriodSaleOutQty;

    /**
     * 本期客退
     */
    @ExcelProperty(value = "本期客退")
    @ApiModelProperty(value = "本期客退")
    private Integer thisPeriodSaleReturnQty;

    /**
     * 本期其他
     */
    @ExcelProperty(value = "本期其他")
    @ApiModelProperty(value = "本期其他")
    private Integer thisPeriodOthersQty;

    /**
     * 本期期末库存
     */
    @ExcelProperty(value = "本期期末库存")
    @ApiModelProperty(value = "本期期末库存")
    private Integer thisPeriodEndQty;

    /**
     * 本月客退上月已结
     */
    @ExcelProperty(value = "本月客退上月已结")
    @ApiModelProperty(value = "本月客退上月已结")
    private Integer thismSalerLastmClosedQty;

    /**
     * 次月客退
     */
    @ExcelProperty(value = "次月客退")
    @ApiModelProperty(value = "次月客退")
    private Integer nextmSaleReturnQty;

    /**
     * 本期其他上月已结
     */
    @ExcelProperty(value = "本期其他上月已结")
    @ApiModelProperty(value = "本期其他上月已结")
    private Integer thispOthersLastmClosedQty;

    /**
     * 次月其他
     */
    @ExcelProperty(value = "次月其他")
    @ApiModelProperty(value = "次月其他")
    private Integer nextmOthersQty;

    /**
     * 本期结算数量
     */
    @ExcelProperty(value = "本期结算数量")
    @ApiModelProperty(value = "本期结算数量")
    private Integer thispClosedQty;

    /**
     * 档期 按[原采购单号]取【INT-唯品会档期表】 取到档期；
     *
     */
    @ExcelProperty(value = "档期")
    private String orderSchedule;

    /**
     * 单价 按[原采购单号]+[条码] 匹配【WP-发货单价】，优先级依次为 [销售单价]、[非退供差异单价]、[退供差异单价]、[发货单价]
     */
    @ExcelProperty(value = "单价")
    private BigDecimal price;

    /**
     * 金额  [本期期末库存]*[单价]
     */
    @ExcelProperty(value = "金额")
    private BigDecimal amount;

    /**
     * 条码税率
     */
    @ExcelProperty(value = "条码税率")
    @ApiModelProperty(value = "条码税率")
    private BigDecimal bracodeTaxRate;

    /**
     * 仓库
     */
    @ExcelProperty(value = "仓库")
    @ApiModelProperty(value = "仓库")
    private String warehouse ;

    /**
     * 店铺编码
     */
    @ExcelProperty(value = "店铺编码")
    @ApiModelProperty(value = "店铺编码")
    private String shopNo ;

    /**
     * 货号
     */
    @ExcelProperty(value = "货号")
    @ApiModelProperty(value = "货号")
    private String articleNum;

    /**
     * 发货模式
     */
    @ExcelProperty(value = "发货模式")
    @ApiModelProperty(value = "发货模式")
    private String jitxModel;

    /**
     * 发货模式 编码
     */
    private Integer jitxModelNo;

    public void setJitxModel(String jitxModel) {
        this.jitxModel = jitxModel;
        if(StringUtils.isBlank(jitxModel)){
            this.jitxModel = "";
        }else{
            Integer jitxModelNo = WpTypeEnum.DELIVERY_TYPE.getNoByName(jitxModel);
            this.jitxModelNo = jitxModelNo;
        }
    }

    /**
     * 档期ID
     */
    @ExcelProperty(value = "档期ID")
    private String calendarId;
}
